<?php
/**
 * 厅主管理费用管理
 * User: 胡诚
 * Date: 2018/11/9
 * Time: 12:02
 */

namespace App\Controllers;

use App\Services\MonthlyService;
use Illuminate\Http\Request;

class MonthlyController extends BaseController
{


    /**
     * 修改保底费
     * @param Request $request
     * @return mixed
     * @throws \Illuminate\Validation\ValidationException
     */
    public function updateMonthly(Request $request)
    {
        $this->validate($request, [
            'hall_id'            => 'required|integer',
            'fee_monthly_amount' => 'required',
        ]);
        $hallId = $request->input('hall_id');
        $money  = $request->input('fee_monthly_amount');
        $money  = amount_format($money, true);
        return MonthlyService::updateCote($hallId, $money);
    }

    public function getMonthly(Request $request)
    {
        $this->validate($request, [
            'hall_id' => 'required|integer',

        ]);
        $hallId = $request->input('hall_id');
        return MonthlyService::getMonthly($hallId);
    }
}
